package com.lu.service;

import com.lu.dao.mapper.BlogMapper;
import com.lu.entity.Blog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by lulu on 2017/8/30.
 */
@Service
public class AdminService {
    @Autowired
    BlogMapper blogMapper;

    public void addBlog(Blog blog) {
        blogMapper.insertSelective(blog);
    }

    public void update(Blog blog) {
        blogMapper.updateByPrimaryKey(blog);
    }

    public void delete(int id) {
        Blog blog = new Blog();
        blog.setId(id);
        blog.setIsshow((byte) 0);
        blogMapper.updateByPrimaryKeySelective(blog);
    }

    public void findBack(int id) {
        Blog blog = new Blog();
        blog.setId(id);
        blog.setIsshow((byte) 1);
        blogMapper.updateByPrimaryKeySelective(blog);
    }
}
